/**
 * 
 */
package com.zte.claa.inficombo.csa.app.config;

import java.util.Arrays;

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;
/**
 * @author zhanghao
 *
 */
@EnableCaching
@Configuration
public class CacheRedisConfig {
    
	public static final String CACHE_NAME = "rediscache";
	
    @Bean
    public RedisCacheManager redisCacheManager(RedisTemplate<String, Object> redisTemplate) {
        RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate, Arrays.asList(CACHE_NAME));
        cacheManager.setUsePrefix(false);  //不使用前缀
        cacheManager.setDefaultExpiration(604800); //最长保留1周
        return cacheManager;
    }
}
